const reportFrequency = {
  '0': '日报',
  '1': '周报',
  '2': '旬报',
  '3': '半月报',
  '4': '月报',
  '5': '季报',
  '6': '半年报',
  '7': '年报',
  '8': '其他'
}
export function convertReportFrequencyCode2Chinese(code: string) {
  return Reflect.has(reportFrequency, code) ? reportFrequency[code] : null
}

export function convertReportFrequencyChinese2Code(chinese: string) {
  const obj: Record<string, any> = {}
  for (const [k, v] of Object.entries(reportFrequency)) {
    obj[v] = k
  }
  return Reflect.has(obj, chinese) ? obj[chinese] : null
}

const flowStatus = {
  '0': '部门待经办',
  '1': '部门待复核',
  '2': '管理信息待经办',
  '3': '管理信息待复核',
  '4': '已完成',
  '5': '已失效',
  '6': '待发起'
}
export function convertFlowStatusCode2Chinese(code: string) {
  return Reflect.has(flowStatus, code) ? flowStatus[code] : null
}

export function convertFlowStatusChinese2Code(chinese: string) {
  const obj: Record<string, any> = {}
  for (const [k, v] of Object.entries(flowStatus)) {
    obj[v] = k
  }
  return Reflect.has(obj, chinese) ? obj[chinese] : null
}

export function convertFlowStatusChinese2Color(chinese: string) {
  const codeMap = {
    部门待经办: '#0077FF',
    部门待复核: '#FFBA4F',
    管理信息待经办: '#0077FF',
    管理信息待复核: '#FFBA4F',
    已完成: '#34DE28',
    已失效: '#B8B8B8',
    待发起: '#0077FF'
  }
  return Reflect.has(codeMap, chinese) ? codeMap[chinese] : null
}

export const reportFrequencyList = Object.values(reportFrequency)

export const statusList = Object.values(flowStatus)
